<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    //函数作为参数使用
    function applyFunction(fn) {
        fn();
    }
    function f1() {
        console.log("I'm f1()");
    }
    applyFunction(f1);
    //函数作为返回值
    function isType(type) {
        return function (obj) {
            var typeString = Object.prototype.toString.call(obj);//===>返回字符串类似于[object Object]
            typeString = typeString.substring(1);
            typeString = typeString.substring(0,typeString.length-1);
            var types = typeString.split(" ");
            return type.toLowerCase() == types[1].toLowerCase();
        }
    }
    var ff = isType("date");
    console.log(ff([]));
</script>
</body>
</html>